<!doctype html>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>

<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <jsp:include page="/common/commonCss.jsp"/> 
  <script src="${basePath}commonJs/jquery.min.js"></script>
<script src="${basePath}commonJs/jquery.imageScroller.js"></script>
<script src="${basePath}commonJs/jquery.easyui.min.js"></script>
<script src="${basePath}commonJs/jt_normal.js"></script>
<script src="${basePath}commonJs/jt_select.js"></script>
<script src="${basePath}commonJs/tags/dialog/dialog.js"></script>
<script type="text/javascript" src="${basePath }commonJs/jt_map.js"></script>
<script  type="text/javascript" src="${basePath }commonJs/tags/page/page.js"></script>
<script type="text/javascript" src="${basePath }commonJs/tags/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
var fujiaPrdArray=[];
var basePath = "${basePath}";
var trimPrdArray=[];
var maxCntRoomArray=[];
var validHolidays="";
var parStatus=new Array("未预付","自动取消","取消","待确认","已确认","进行中","完成","删除");
var pkParresIdOld ='${pkParresId}';
 var pkOrderIdOld='${pkOrderId}';
$(document).ready(function() {
	var grpFlag ='${parType}';
	if(grpFlag==0){
	$("input[@type=radio][id=r1]").attr("checked",true);
	}else{
		$("input[@type=radio][id=r2]").attr("checked",true);
	}
	initValidHoliday();
	$("#modiTimedis").val(dateFormt(new Date()));
	loadTypeTimeValue();
	loadParStatus();
	loadParTaocan();
	loadQCengTaocan();
	 alreadyZhu();
	 alreadyYinl();
	 alreadyPeiCai();
	 loadAlreadyRoom();
	 //===================
	 var maxCntlistRoom ='${listRoom}';
	 if(null!=maxCntlistRoom){
		 <c:forEach items="${listRoom}" var="room" varStatus="status">
		 maxCntRoomArray.push("${room.pkRoomId}@${room.roomName}@${room.maxCnt}@${room.minCnt}");//此处的 数组 是为了  方便 验证总人数不能超过房间最大容量，否则提示“房间容量超限”
		</c:forEach>
	 }
	 //=====================
	 document.getElementById("dfujiaTableDiv").style.display='block';
	 if(pkParresIdOld!=""){
		 var basicPkg2old='${parreserveOld.basicPkg2}';
		 if(basicPkg2old!=""){
			 fujiaPrdArray=basicPkg2old.split(",");
		 }
		 var basicPkg3old='${parreserveOld.basicPkg3}';
		 if(basicPkg3old!=""){
			 trimPrdArray=basicPkg3old.split(",");
		 }
		 $("#fujiaTable").remove();
		 $("#foot1").remove();
		 document.getElementById("addfujiaTableDiv").style.display='block';
		 document.getElementById("addfoot1").style.display='block';
		 initTab("addformFujia4", "addfujiaTable", "addfoot1", addTrFujia);
		 $("#trimmingtable").remove();
		 $("#foot2").remove();
		 document.getElementById("addtrimmingtableDiv").style.display='block';
		 document.getElementById("addfoot2").style.display='block';
		 initTabTrim("addformZhuangshi4", "addtrimmingtable", "addfoot2", addTrming);
	 }else{
		 fujiaPrdArray=[];trimPrdArray=[];
		 initTab("formFujia4", "fujiaTable", "foot1", initTrFujia);
		 initTabTrim("formZhuangshi4", "trimmingtable", "foot2", initTrming);
	 }
	 
	//loadBackbutton();
});

function loadBackbutton(){
	
}
function loadTypeTimeValue(){
	var basicPkg='${parreserveOld.basicPkg}';
	var resTimeS='${parreserveOld.resTimeS}';
	var resTimeE='${parreserveOld.resTimeE}';
	var overTime ='${parreserveOld.overTime}';
	var fkOtprdId ='${parreserveOld.fkOtprdId}';
	
	if(basicPkg!=""){
		var typeValue=basicPkg.substring(0, basicPkg.indexOf("#"));
		 $("#typeTaocan").val(typeValue);
		 var disableIsShow ='${disableIsShow}';
			if(disableIsShow=='disabled'){
				var taoText ='';
				if(typeValue=='ZBSP1408070540'){
					taoText ='团体4小时单人（不含餐）';
				}else if(typeValue=='ZBSP1408070541'){
					taoText ='团体4小时单人（含餐）';
				}else if(typeValue=='ZBSP1408070542'){
					taoText ='团体6小时单人（含餐）';
				} 
				 $("#typeTaocan").empty();
		     $("#typeTaocan").append("<option value='"+typeValue+"'>"+taoText+"</option>");
			}
	}
	$("#fkOtprdId").val(fkOtprdId);
	$("#overTime").val(overTime);
	$("#resTimeS").val(resTimeS);
	$("#resTimeE").val(resTimeE);
	if(resTimeE!=""){
		var newValust=resTimeE.substring(0, 2)+":"+resTimeE.substring(2, 4);
		$("#showresTimeE").val(newValust);
	}
	refreshSelect();
}
function dateFormt(date){
	var now=date;
	var dateNows= now.toLocaleDateString();
	var hours=now.getHours();
	var minutes=now.getMinutes();
	var seconds=now.getSeconds();
		return dateNows +" " +hours+":"+minutes+":"+seconds;
}
 function loadAlreadyRoom(){
	 var parReserveRoomList= '${parReserveRoomList}';
	 if(parReserveRoomList!=null){
		 <c:forEach items="${parReserveRoomList}" var="parReserveRoom" varStatus="status">
			 var pkRoomid="pkRoomid${parReserveRoom.fkRoomId}";
			 var roomCheckbox= document.getElementById(pkRoomid);
			 if(roomCheckbox!=null){
				 roomCheckbox.checked=true;
			 }
		 </c:forEach>
		 }
 }

function initTab(formId, tableId, footId, initTr) {
	var form = $("#" + formId);
	var pagebean = new PageBean(form);
	pagebean.setCallback(initTr);
	pagebean.setFootId(footId);
	pagebean.setTableId(tableId);
	setPagebeanObj(pagebean);
	pagebean.doPage();
}

function initTabTrim(formId, tableId, footId, initTr) {
	var form = $("#" + formId);
	var pagebean = new PageBean(form);
	pagebean.setCallback(initTr);
	pagebean.setFootId(footId);
	pagebean.setTableId(tableId);
	setPagebeanObj(pagebean);
	pagebean.doPage();
}

function qtyUpdate(kind,ind,type){
	if (!validaTuanForm('')) {
	} else {
	var inputId ;
	var typeLength =0;
	 if(type=='fujia'){
		 typeLength = 3;
		 inputId="qty"+ind;
	 }else{
		 inputId="zhuangshiTr"+ind;
	 }
    var f = document.getElementById(inputId);
    var c = f.value;
    if(kind == 1){
        c++;
    }else if(kind == 2){
        if(c >= 1) c--;
    }
    f.value = c;
    var resulthArray = [];
    resulthArray =addInputFujiaArray(c,ind,type);
		 if (typeLength == 3) {
				$("#basicPkg2").val(resulthArray);
				$("#paramtype").val('fujia');
				var baspk3Value = getAddPrds("qiqiuTriBox", "");//  装饰  值
				$("#basicPkg3").val(baspk3Value);
			} else {
				$("#basicPkg3").val(resulthArray);
				$("#paramtype").val('zhuangshi');
				 var basp2Value = getAddPrds("fujiacBox", "");//  附加菜单  值
					$("#basicPkg2").val(basp2Value);
			}
		  
		 saveInputNum(typeLength);
	}
}

function saveInputNum(typeLength){
	
	var resTimeSF = $("#resTimeS").val();
	if (resTimeSF == "") {
		$.messager.alert('提示', '请选择开始时间！', 'warning');
		$("#resTimeS").val("");
		refreshSelect();
		return;
	}
	//===
	var typeTaocanId = $("#typeTaocan").val();
	var pkRoomIdtr = checkRoomId();
		var valdateTaocan = validaUTaocan();
		$("#roomIds").val(pkRoomIdtr);
		if (typeTaocanId == "ZBSP1408070540") {
			$("#basicPkg").val(typeTaocanId + "#");
		} else {
			$("#basicPkg").val(typeTaocanId+ "#"+ valdateTaocan);
		}
//===
	var url = '${basePath }parreserve/updateYazhengNum.shtml';
	$
			.ajax({
				url : url,
				type : 'POST',
				data : $("#form1").serialize(),//序列化表单里所有的内容
				async : false,
				error : function(XMLHttpRequest) {
					ajaxError(XMLHttpRequest);
				},
				success : function(data) {
					if (null != data && data != "") {
						if (data.indexOf("@@") != -1) {
							var pkParresIdOld = data.substring(0, data
									.indexOf("@@"));
							window.location.href = "${basePath }parreserve/tuanReserveDetail.shtml?parType=1&pkParresId="
									+ pkParresIdOld + "&pkOrderId=";
						} else {
							if (typeLength == 3) {
								$("#fujiaTable").remove();
								document
										.getElementById("addfujiaTableDiv").style.display = 'block';
								$("#addbasicPkg2").val(data);
								addTrFujia();
							} else {
								$("#trimmingtable").remove(); 
								document
										.getElementById("addtrimmingtableDiv").style.display = 'block';
								$("#addbasicPkg3").val(data);
								addTrming();
							}
						}
					}
				}
			});
}

function loadParStatus(){
	var parstatus ='${parreserveOld.resStatus}';
	if(parstatus!=""){
		var parStatusName=parStatus[parstatus-1];
		document.getElementById("parstatus").innerHTML='<label>状态：</label>'+parStatusName;
	}else{
		document.getElementById("parstatus").innerHTML='<label>状态：</label>'+parStatus[0];
	}
}

function addInputFujiaArray(value,ind,type){//附加菜单列表，装饰列表 页面输入 购买数量 ，添加 到 全局数组
	var delPrd='';
	var resultyArray=[];
	  if(type=='fujia'){
	    	if(fujiaPrdArray.length==0){
	    		fujiaPrdArray.push(ind+"#"+value);
	    	}else{
	    		
	    		for(var k=0;k<fujiaPrdArray.length;k++){
	    			if(fujiaPrdArray[k].lastIndexOf(ind)!=-1){
	    				delPrd=fujiaPrdArray[k];
	    				break;
	    			}
	    		}
	    		fujiaPrdArray.remove(delPrd);//删除旧的 值
	    		fujiaPrdArray.push(ind+"#"+value);
	    	}
	    	resultyArray =fujiaPrdArray;
		 }else{
			 if(trimPrdArray.length==0){
				 trimPrdArray.push(ind+"#"+value);
		    	}else{
		    		
		    		for(var m=0;m<trimPrdArray.length;m++){
		    			if(trimPrdArray[m].lastIndexOf(ind)!=-1){
		    				delPrd=trimPrdArray[m];
		    				break;
		    			}
		    		}
		    		trimPrdArray.remove(delPrd);//删除旧的 值
		    		trimPrdArray.push(ind+"#"+value);
		    	}
			 resultyArray =trimPrdArray;
		 }
	  return resultyArray;
}
function initTrFujia(data) { //初始化 附加菜单 列表
	if(data!=null){
		$.each(data,function(ind,obj){
			var htm="<tr>";
			htm+="<td>"+obj.prdName+"</td>";
			htm+=" <td>"+obj.productPrice+"</td>";
			var quantCount =obj.quantity;
			if(quantCount==null){
				quantCount=0;
			}
			var qty1="qtyUpdate(1,'"+obj.pkPrdId+"','fujia')";//增加按钮操作
			var qty2="qtyUpdate(2,'"+obj.pkPrdId+"','fujia')";//减少按钮操作
			var yanzhengNum ="yazhengNum(this,3)";
			var delButton ="del(this,11)";
			var disableIsShow ='${disableIsShow}';
			var delButtClass = "btn_l";
			if(disableIsShow=='disabled'){
				qty1="";qty2="";yanzhengNum="";delButton="";
				delButtClass ="btn_l_no";
				
			}
			
	htm += '<td><a href="javascript:'+qty2+'" class="jia_icon"></a><input value="'
										+ quantCount
										+ '" type="text" name="qty" id="qty'
										+ obj.pkPrdId
										+ '" onkeyup="'+yanzhengNum+'" class="iput_t w50" '+disableIsShow+'  ><a href="javascript:'+qty1+'" class="jian_icon"></a></td>';
								htm += '<td><input type="button" id="bu'
										+ obj.pkPrdId
										+ '" value="删除" onclick="'+delButton+'" class="'+delButtClass+'"></td></tr>';
								htm += "</tr>";
								fujiaPrdArray.push(obj.pkPrdId + "#" + 0);
								$("#fujiaTable").find("tr:eq(" + ind + ")")
										.after(htm);
							});
		}
	}

	function addTrFujia(data) { //add后的  附加菜单 列表
		if (data != null) {
			$
					.each(
							data,
							function(ind, obj) {
								var htm = "<tr>";
								htm += "<td>" + obj.prdName + "</td>";
								htm += " <td>" + obj.productPrice + "</td>";
								var quantCount = obj.quantity;
								if (quantCount == null) {
									quantCount = 0;
								}
								var qty1 = "qtyUpdate(1,'" + obj.pkPrdId+ "','fujia')";//增加按钮操作
								var qty2 = "qtyUpdate(2,'" + obj.pkPrdId+ "','fujia')";//减少按钮操作
								var yanzhengNum ="yazhengNum(this,3)";
								var delButton ="del(this,12)";
								var disableIsShow ='${disableIsShow}';
								var delButtClass = "btn_l";
								if(disableIsShow=='disabled'){
									qty1="";qty2="";yanzhengNum="";delButton="";
									delButtClass ="btn_l_no";
									
								}
								htm += '<td><a href="javascript:'+qty2+'" class="jia_icon"></a><input value="'
										+ quantCount
										+ '" type="text" name="qty" id="qty'
										+ obj.pkPrdId
										+ '" onkeyup="'+yanzhengNum+'" '+disableIsShow+' class="iput_t w50"   ><a href="javascript:'+qty1+'" class="jian_icon"></a></td>';
								htm += '<td><input type="button" id="bu'
										+ obj.pkPrdId
										+ '" value="删除" onclick="'+delButton+'" class="'+delButtClass+'"></td></tr>';
								htm += "</tr>";

								$("#addfujiaTable").find("tr:eq(" + ind + ")")
										.after(htm);
							});
		}
	}
	function initTrming(data) {//初始化 装饰 分页列表
		if (data != null) {
			$
					.each(
							data,
							function(ind, obj) {
								var htm = "<tr>";
								htm += "<td>" + obj.prdName + "</td>";
								htm += " <td>" + obj.productPrice + "</td>";
								var quantCount = obj.quantity;
								if (quantCount == null) {
									quantCount = 0;
								}
								var qty1 = "qtyUpdate(1,'" + obj.pkPrdId+ "','zhuangshiTr')";//增加按钮操作
								var qty2 = "qtyUpdate(2,'" + obj.pkPrdId+ "','zhuangshiTr')";//减少按钮操作
								var yanzhengNum ="yazhengNum(this,11)";
								var delButton ="del(this,21)";
								var disableIsShow ='${disableIsShow}';
								var delButtClass = "btn_l";
								if(disableIsShow=='disabled'){
									qty1="";qty2="";yanzhengNum="";delButton="";
									delButtClass ="btn_l_no";
									
								}
								htm += '<td><a href="javascript:'+qty2+'" class="jia_icon"></a><input value="'
										+ quantCount
										+ '" type="text" name="zhuangshiTr" id="zhuangshiTr'
										+ obj.pkPrdId
										+ '" onkeyup="'+yanzhengNum+'" '+disableIsShow+' class="iput_t w50"   ><a href="javascript:'+qty1+'" class="jian_icon"></a></td>';
								htm += '<td><input type="button" id="zbu'
										+ obj.pkPrdId
										+ '" value="删除" onclick="'+delButton+'" class="'+delButtClass+'"></td></tr>';
								htm += "</tr>";
								trimPrdArray.push(obj.pkPrdId + "#" + 0);
								$("#trimmingtable").find("tr:eq(" + ind + ")")
										.after(htm);
							});
		}
	}
	function addTrming(data) {//add后的 装饰 分页列表
		if (data != null) {
			$
					.each(
							data,
							function(ind, obj) {
								var htm = "<tr>";
								htm += "<td>" + obj.prdName + "</td>";
								htm += " <td>" + obj.productPrice + "</td>";
								var quantCount = obj.quantity;
								if (quantCount == null) {
									quantCount = 0;
								}
								var qty1 = "qtyUpdate(1,'" + obj.pkPrdId+ "','zhuangshiTr')";//增加按钮操作
								var qty2 = "qtyUpdate(2,'" + obj.pkPrdId+ "','zhuangshiTr')";//减少按钮操作
								var yanzhengNum ="yazhengNum(this,11)";
								var delButton ="del(this,22)";
								var disableIsShow ='${disableIsShow}';
								var delButtClass = "btn_l";
								if(disableIsShow=='disabled'){
									qty1="";qty2="";yanzhengNum="";delButton="";
									delButtClass ="btn_l_no";
									
								}
								htm += '<td><a href="javascript:'+qty2+'" class="jia_icon"></a><input value="'
										+ quantCount
										+ '" type="text" name="zhuangshiTr" id="zhuangshiTr'
										+ obj.pkPrdId
										+ '" onkeyup="'+yanzhengNum+'" '+disableIsShow+' class="iput_t w50"   ><a href="javascript:'+qty1+'" class="jian_icon"></a></td>';
								htm += '<td><input type="button" id="zbu'
										+ obj.pkPrdId
										+ '" value="删除" onclick="'+delButton+'" class="'+delButtClass+'"></td></tr>';
								htm += "</tr>";

								$("#addtrimmingtable").find(
										"tr:eq(" + ind + ")").after(htm);
							});
		}
	}
	function yazhengNum(o, typeLength) {
		if (!validaTuanForm('')) {
		} else {
		if (!isNaN(o.value)) {
			var inputId = o.id;
			var prdId;
			prdId = inputId.substring(typeLength, inputId.length);
			var resulthArray = [];
			if (typeLength == 3) {
				resulthArray = addInputFujiaArray(o.value, prdId, "fujia");
				$("#basicPkg2").val(resulthArray);
				$("#paramtype").val('fujia');
				var baspk3Value = getAddPrds("qiqiuTriBox", "");//  装饰  值
				$("#basicPkg3").val(baspk3Value);
			} else {
				resulthArray = addInputFujiaArray(o.value, prdId, "zhuangshi");
				$("#basicPkg3").val(resulthArray);
				$("#paramtype").val('zhuangshi');
				  var basp2Value = getAddPrds("fujiacBox", "");//  附加菜单  值
					$("#basicPkg2").val(basp2Value);
			}
			saveInputNum(typeLength);
			 
		} else {
			$.messager.alert('提示', '请输入大于0的数字！', 'warning');
			o.value = '0';
		}
	}

	}
	function openCengValid(cengType) {
		if (!validaTuanForm(cengType)) {
			return false;
		}
		var typeTaocanId = $("#typeTaocan").val();
		if (typeTaocanId == "") {
			$.messager.alert('提示', '请选择类型！', 'warning');
			return false;
		}
		var pkRoomIdtr = checkRoomId();
		if (pkRoomIdtr == "") {
			$.messager.alert('提示', '请选择房间！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return false;
		}
		var resTimeSF = $("#resTimeS").val();
		if (resTimeSF == "") {
			$.messager.alert('提示', '请选择开始时间！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return false;
		}
		//=======ajax 根据房间编号，时间，查找是否 房间已经占用
		var ptime = resTimeSF.substring(0, 2);
		var typeTaocanId = $("#typeTaocan").val();
		var houTime;
		if (typeTaocanId != "" && typeTaocanId == "ZBSP1408070542") {
			if (ptime.substring(0, 1) == 0) {
				houTime = parseInt(ptime.substring(1, 2)) + 6;
			} else {
				houTime = parseInt(ptime) + 6;
			}

		} else {
			if (ptime.substring(0, 1) == 0) {
				houTime = parseInt(ptime.substring(1, 2)) + 4;
			} else {
				houTime = parseInt(ptime) + 4;
			}
		}
		var dresTimeE = houTime + resTimeSF.substring(2, 4);
		var showTimeE = houTime + ":" + resTimeSF.substring(2, 4);
		var rpresDay = $("#presDay").val();
		var pkParresId = $("#pkParresId").val();
		var url = '${basePath }parreserve/findAlreadyRoomList.shtml';
		$.ajax({
			url : url,
			type : 'POST',
			data : "roomId=" + pkRoomIdtr + "&presDay=" + rpresDay
					+ "&resTimeS=" + resTimeSF + "&resTimeE=" + dresTimeE
					+ "&pkParresId=" + pkParresId,
			async : false,
			error : function(XMLHttpRequest) {
				ajaxError(XMLHttpRequest);
			},
			success : function(data) {
				if (data != null) {
					var parReserveList;
					for ( var o in data) {
						if (o == "parReserveList") {
							jsonarray = data[o];
							if (jsonarray != null && jsonarray.length > 0) {
								var resTimestext;
								var resTimeEtext;
								var roomName = "(";
								for (var k = 0; k < jsonarray.length; k++) {
									var jsonobj = jsonarray[k];
									if (jsonobj != null) {
										resTimestext = jsonobj["resTimeS"];
										resTimeEtext = jsonobj["resTimeE"];
										roomName += jsonobj["roomName"] + " ";
									}
								}
								roomName += ")";
								var msg = rpresDay + " " + resTimestext + "-"
										+ resTimeEtext + " 时间段的房间" + roomName
										+ " 已经被预约，请重新选择时间段或 房间！";
								$.messager.alert('提示', msg, 'warning');
								$("#resTimeS").val("");
								refreshSelect();
								return false;
							}
						}
					}
				} else {
					$.messager.alert('提示', '保存失败！', 'error');
				}
			}
		});
		//======== 
		if (cengType == "#fujia" || cengType == "#p") {
			var valdateTaocan = validaUTaocan();
			if ((typeTaocanId == "ZBSP1408070541" || typeTaocanId == "ZBSP1408070542")
					&& valdateTaocan.length < 12) {
				$.messager.alert('提示', '请重新修改 选择 搭配套餐！', 'warning');
				return false;
			}
		}
		if (validaTuanForm(cengType)) {
			$(cengType).window('open');
		}
	}

	function changeTaocanDiv() {
		var typeTaocanId = $("#typeTaocan").val();
		if (typeTaocanId == "") {
			$.messager.alert('提示', '请选择类型！', 'warning');
			return false;
		}
	}
	function loadParTaocan() {
		var arr = [];
		var disableIshow ='${disableIsShow}';
		var divIdP = "openCengValid('#q')";
		var divopen = '"open"';
		var taocanSize = '${gblScmTaocanSize}';
		arr.push('<table class="table">');
		if ('${listGblScmTaocan}' == '[]') {
			arr.push('<tr><td>主食1</td> ');
			arr.push('<td rowspan="1">');
			
			
			 if(disableIshow=='disabled'){
				 arr.push('<input type="button"  class="btn_no" value="修&nbsp;&nbsp;改">');
			}else{
			arr.push('<input type="button" onClick=" '+divIdP+' " class="btn" value="修&nbsp;&nbsp;改">')
			}
			arr.push('</td></tr>');
		} else {
			<c:forEach items="${listGblScmTaocan}" var="parTaocan" varStatus="status">
			<c:choose>
			<c:when test="${status.index==0}">
			arr.push('<tr><td>主食1</td><td>${parTaocan.cateName}：${parTaocan.prdName} </td>');
			arr.push('<td rowspan="${gblScmTaocanSize}">');
			 if(disableIshow=='disabled'){
				 arr.push('<input type="button"  class="btn_no" value="修&nbsp;&nbsp;改">');
			}else{
		    	arr.push('<input type="button" onClick=" '+divIdP+' " class="btn" value="修&nbsp;&nbsp;改">');
			}
			arr.push('</td></tr>');
			</c:when>
			<c:when test="${status.index==1 }">
			arr
					.push('<tr><td>主食2</td><td>${parTaocan.cateName}：${parTaocan.prdName} </td></tr>');
			</c:when>
			<c:when test="${status.index==2 && parTaocan.fkPrdcateId=='001007001002'}">
			arr
					.push('<tr><td>主食3</td><td>${parTaocan.cateName}：${parTaocan.prdName} </td></tr>');
			</c:when>
			<c:otherwise>
			arr
					.push('<tr><td>${parTaocan.cateName}</td><td>${parTaocan.prdName} </td></tr>');
			</c:otherwise>
			</c:choose>
			</c:forEach>
		}
		arr.push('</table>');
		var parTaocanDiv = document.getElementById("parTaocan");
		parTaocanDiv.innerHTML = arr.join('');
	}
	function loadQCengTaocan() {
		var arr = [];
		arr.push('<ul id="tab_conbox_a" class="fixed p10">');
		arr.push('<li>');
		arr.push('<dl class="order_add_peic fl">');
		arr
				.push('<div id="hoverre" class="peic_hover"><dt ><a href="javascript:updateTaocanzhushi(1)">热食</a></dt></div>');
		arr
				.push('<div id="hoverleng" > <dt><a href="javascript:updateTaocanzhushi(2)">冷食</a></dt></div>');
		arr.push(' </dl>');
		arr.push('<dl class="fl order_add_peib">');
		arr.push('<div id="updatezhushiRe">');
		var taocanonChange = "";
		<c:forEach items="${listGblZhuRe}" var="zhure" varStatus="status" >
		taocanonChange = "taoOnChange('${zhure.pkPrdId}_alreadyZhu@${zhure.prdName}')";
		arr
				.push('<dd><input type="checkbox" id="${zhure.pkPrdId}"  onclick="'+taocanonChange+'"  name="zhubox" value="${zhure.pkPrdId}">${zhure.prdName} </dd> ');
		</c:forEach>
		arr.push('</div>');
		arr.push('<div id="updatezhushiLeng" style="display:none">');
		<c:forEach items="${listGblZhuLeng}" var="zhuLeng" varStatus="status" >
		taocanonChange = "taoOnChange('${zhuLeng.pkPrdId}_alreadyZhu@${zhuLeng.prdName}')";
		arr
				.push('<dd><input type="checkbox" id="${zhuLeng.pkPrdId}" onclick="'+taocanonChange+'"  name="zhubox" value="${zhuLeng.pkPrdId}">${zhuLeng.prdName} </dd>');
		</c:forEach>
		arr.push('</div></dl></li>');
		arr
				.push('<div  style="display:none"><li><dl class="fl order_add_peib">');
		<c:forEach items="${listGblpeicai}" var="peicai" varStatus="status">
		taocanonChange = "taoOnChange('${peicai.pkPrdId}_alreadyPeiCai@${peicai.prdName}')";
		arr
				.push('<dd><input type="radio" id="${peicai.pkPrdId}" onclick="'+taocanonChange+'" name="peicaiRadio" value="${peicai.pkPrdId}">${peicai.prdName}</dd>');
		</c:forEach>
		arr.push('</dl></li></div>');
		arr
				.push('<div  style="display:none"><li><dl class="fl order_add_peib">');
		<c:forEach items="${listGblparYinliao}" var="yinliao" varStatus="status">
		taocanonChange = "taoOnChange('${yinliao.pkPrdId}_alreadyYinl@${yinliao.prdName}')";
		arr
				.push('<dd><input type="radio" id="${yinliao.pkPrdId}" onclick="'+taocanonChange+'" name="yinliaoRadio" value="${yinliao.pkPrdId}">${yinliao.prdName}</dd>');
		</c:forEach>
		arr.push('</dl></li></div></ul>');
		var cengzhushiDiv = document.getElementById("cengzhushi");
		cengzhushiDiv.innerHTML = arr.join('');
	}
	var hiddenselct = "";
	function alreadyYinl() {//加载 默认 已选套餐的饮料
		//<div id="alreadyYinl">
		var arr = [];
		<c:forEach items="${listGblScmTaocan}" var="parTaocan" varStatus="status">
		var delAlreadonclick = "delAlreadyTaocan('${parTaocan.pkPrdId}')";
		<c:choose>
		<c:when test="${parTaocan.fkPrdcateId=='001007003' }">
		arr
				.push('<dd id="pAlready${parTaocan.pkPrdId}">${parTaocan.prdName}<a onclick='+delAlreadonclick+' class=" delete_icon fr"></a></dd>');
		document.getElementById('${parTaocan.pkPrdId}').checked = true;
		</c:when>
		<c:otherwise>
		</c:otherwise>
		</c:choose>
		</c:forEach>
		var alreadyYinlDiv = document.getElementById("alreadyYinl");
		alreadyYinlDiv.innerHTML = arr.join('');
	}

	function delAlreadyTaocan(divId) {
		document.getElementById(divId).checked = false;
		var alreadydivid = "#pAlready" + divId;
		$(alreadydivid).remove();
	}
	function alreadyPeiCai() {//加载 默认 已选套餐的配菜
		//<div id="alreadyPeiCai">
		var arr = [];
		<c:forEach items="${listGblScmTaocan}" var="parTaocan" varStatus="status">
		var delAlreadonclick = "delAlreadyTaocan('${parTaocan.pkPrdId}')";
		<c:choose>
		<c:when test="${parTaocan.fkPrdcateId=='001007002' }">
		arr
				.push('<dd id="pAlready${parTaocan.pkPrdId}">${parTaocan.prdName}  <a onclick='+delAlreadonclick+' class=" delete_icon fr"></a></dd>');
		document.getElementById('${parTaocan.pkPrdId}').checked = true;
		</c:when>
		<c:otherwise>
		</c:otherwise>
		</c:choose>
		</c:forEach>
		var alreadyPeiCaiDiv = document.getElementById("alreadyPeiCai");
		alreadyPeiCaiDiv.innerHTML = arr.join('');
	}

	function alreadyZhu() {//加载 默认 已选套餐的主食
		//<div id="alreadyZhu">
		var arr = [];
		<c:forEach items="${listGblScmTaocan}" var="parTaocan" varStatus="status">
		var delAlreadonclick = "delAlreadyTaocan('${parTaocan.pkPrdId}')";
		<c:choose>
		<c:when test="${parTaocan.fkPrdcateId=='001007001001'   }">
		arr
				.push(' <dd  id="pAlready${parTaocan.pkPrdId}">${parTaocan.prdName} <a onclick='+delAlreadonclick+' class=" delete_icon fr"></a></dd> ');
		document.getElementById('${parTaocan.pkPrdId}').checked = true;
		</c:when>
		<c:when test="${  parTaocan.fkPrdcateId=='001007001002' }">
		arr
				.push(' <dd  id="pAlready${parTaocan.pkPrdId}">${parTaocan.prdName} <a onclick='+delAlreadonclick+' class=" delete_icon fr"></a></dd> ');
		document.getElementById('${parTaocan.pkPrdId}').checked = true;
		</c:when>
		<c:otherwise>
		</c:otherwise>
		</c:choose>
		</c:forEach>
		var alreadyZhuDiv = document.getElementById("alreadyZhu");
		alreadyZhuDiv.innerHTML = arr.join('');
	}

	function taoOnChange(divIds) {
		var checkDivId = divIds.substring(0, divIds.indexOf('_'));
		var str = document.getElementsByName("zhubox");
		var chestr = "";
		var indexZhushi = 0;
		for (var i = 0; i < str.length; i++) {
			if (str[i].checked) {
				chestr += str[i].value + ",";
				indexZhushi++;
			}
		}
		if (indexZhushi > 2) {
			document.getElementById(checkDivId).checked = false;
			$.messager.alert('提示', '团体预约最多只能选择2个主食！', 'warning');
			return;// 以上为验证 所选 的 主食套餐 是否大于2
		} else {

			var divId = divIds.substring(0, divIds.indexOf('@'));
			var prdName = divIds.substring(divIds.indexOf('@') + 1,
					divIds.length);
			var zhuDiv = divId.substring(divId.indexOf("_") + 1, divId.length);
			var alreadyZhuDiv = document.getElementById(zhuDiv);
			if (document.getElementById(checkDivId).checked) {
				var delAlreadyoncli = "delAlreadyTaocan('" + checkDivId + "')";
				if (zhuDiv == "alreadyPeiCai" || zhuDiv == "alreadyYinl") {
					alreadyZhuDiv.innerHTML = '<dd id="pAlready'+checkDivId+'">'
							+ prdName
							+ '<a onclick='+delAlreadyoncli+' class=" delete_icon fr"></a></dd>';//配菜，饮料 都是 最能选择1.所以 是innerHTML
				} else {
					$(alreadyZhuDiv)
							.append(
									'<dd id="pAlready'+checkDivId+'">'
											+ prdName
											+ '<a onclick='+delAlreadyoncli+' class=" delete_icon fr"></a></dd>');
				}

			} else {
				var pAlreadydivid = "#pAlready" + checkDivId;
				$(pAlreadydivid).remove();

			}
		}

	}
	function validaUTaocan() {
		var str = document.getElementsByName("zhubox");
		var chestr = "";
		var indexZhushi = 0;
		for (var i = 0; i < str.length; i++) {
			if (str[i].checked) {
				chestr += str[i].value + ",";
				indexZhushi++;
			}
		}
		var trueFlag = true;
		if (chestr == "") {
			//$.messager.alert('提示','团体预约请先选择2个主食！','warning');
			//trueFlag=false;
		}

		if (chestr != "" && indexZhushi < 2) {
			var chaIndex = 2 - indexZhushi;
			if (chaIndex > 0) {
				// $.messager.alert('提示','请先选择2个主食！还差'+chaIndex+'个主食可以选择哦','warning');
				// trueFlag=false;
			}
		} else if (indexZhushi > 2) {
			$.messager.alert('提示', '团体预约最多只能选择2个主食！', 'warning');
			trueFlag = false;
			return false;
		}
		// 以下是配菜 的验证
		var strpeicaiRadio = document.getElementsByName("peicaiRadio");
		var peicaistr = "";
		for (i = 0; i < strpeicaiRadio.length; i++) {
			if (strpeicaiRadio[i].checked) {
				peicaistr += strpeicaiRadio[i].value;
				break;
			}
		}
		if (peicaistr == "") {
			//$.messager.alert('提示','请先选择1个配菜！','warning');
			//trueFlag=false;
		}
		// 以下是饮料 的验证
		var stryinliaoRadio = document.getElementsByName("yinliaoRadio");
		var yinliaostr = "";
		for (i = 0; i < stryinliaoRadio.length; i++) {
			if (stryinliaoRadio[i].checked) {
				yinliaostr += stryinliaoRadio[i].value;
				break;
			}
		}
		if (yinliaostr == "") {
			//$.messager.alert('提示','请先选择1个饮料！','warning');
			// trueFlag=false;
		}
		return chestr + peicaistr + "," + yinliaostr;
	}
	function getAddPrds(typeName1, saveType) {
		var str = document.getElementsByName(typeName1);
		var chestr = "";
		var indexZhushi = 0;
		for (var i = 0; i < str.length; i++) {
			if (str[i].checked) {
				var delPrd = '';
				var sPrdId = '';
				var pushFlag = true;
				var checkValue = str[i].value;

				//==
				if (typeName1 == "fujiacBox") {
					for (var k = 0; k < fujiaPrdArray.length; k++) {
						var delfujiaArray = fujiaPrdArray[k].split("#");
						sPrdId = delfujiaArray[0];
						if (checkValue == sPrdId && delfujiaArray[1] == 0) {
							delPrd += fujiaPrdArray[k] + ",";
						} else if (checkValue == sPrdId && delfujiaArray[1] > 0) {
							pushFlag = false;// 当以前已经 选择 这个商品，则 不push 到数组中
						}
					}
					var delPrds = delPrd.split(",");
					for ( var x in delPrds) {
						fujiaPrdArray.remove(delPrds[x]);//删除旧的 值
					} ///以上 循环 先删除 重复值，再新增
					//===
					if (pushFlag) {
						fujiaPrdArray.push(checkValue + "#0");
					}
				} else {
					for (var m = 0; m < trimPrdArray.length; m++) {
						var delTrimArray = trimPrdArray[m].split("#");

						var sPrdId = delTrimArray[0];
						if (checkValue == sPrdId && delTrimArray[1] == 0) {//delTrimArray[1]==0 这个判断条件 ，避免 删除 购买过的数量数量商品
							delPrd += trimPrdArray[m] + ",";
						} else if (checkValue == sPrdId && delTrimArray[1] > 0) {
							pushFlag = false;// 当以前已经 选择 这个商品，则 不push 到数组中
						}
					}
					var delPrds = delPrd.split(",");
					for ( var xx in delPrds) {
						trimPrdArray.remove(delPrds[xx]);//删除旧的 值
					}
					if (pushFlag) {
						trimPrdArray.push(checkValue + "#0");
					}
				}
				indexZhushi++;
			}
		}
		var inputNumArray = [];
		if (typeName1 == "fujiacBox") {
			inputNumArray = fujiaPrdArray;//附加列表页面 输入 的 菜单 购买数量 数组
		} else {
			inputNumArray = trimPrdArray;//装饰物列表页面 输入 的 菜单 购买数量数组
		}
		if (inputNumArray != null && inputNumArray != '') {
			for (var k = 0; k < inputNumArray.length; k++) {
				var inputNumId = inputNumArray[k];
				var numIds = inputNumId.split("#");
				if (saveType == "nextSave") {//最终保存 到下一步 时，验证 是否有 购买数量 为0 的 商品编号。
					if (numIds[1] == "" || numIds[1] == "0" || numIds[1] == 0) {
						continue;
					} else {
						if (k == inputNumArray.length - 1) {
							chestr += inputNumId;
						} else {
							chestr += inputNumId + ",";
						}

					}
				} else {
					if (k == inputNumArray.length - 1) {
						chestr += inputNumId;
					} else {
						chestr += inputNumId + ",";
					}
				}

			}
		}
		return chestr;
	}

	function fujiaDiv(divId) {//增加 附加 菜单 
		if (!validaTuanForm(divId)) {
		} else {
			var pkRoomIdtr = checkRoomId();
			if (pkRoomIdtr == "") {
				$.messager.alert('提示', '请选择房间！', 'warning');
				$("#resTimeS").val("");
				refreshSelect();
				return;
			}
			var resTimeSF = $("#resTimeS").val();
			if (resTimeSF == "") {
				$.messager.alert('提示', '请选择开始时间！', 'warning');
				$("#resTimeS").val("");
				refreshSelect();
				return;
			}

			var ptime = resTimeSF.substring(0, 2);
			var typeTaocanId = $("#typeTaocan").val();
			var houTime;
			if (typeTaocanId != "" && typeTaocanId == "ZBSP1408070542") {
				if (ptime.substring(0, 1) == 0) {
					houTime = parseInt(ptime.substring(1, 2)) + 6;
				} else {
					houTime = parseInt(ptime) + 6;
				}

			} else {
				if (ptime.substring(0, 1) == 0) {
					houTime = parseInt(ptime.substring(1, 2)) + 4;
				} else {
					houTime = parseInt(ptime) + 4;
				}
			}
			//start===save
			var dresTimeE = houTime + resTimeSF.substring(2, 4);
			$("#resTimeE").val(dresTimeE);
			$("#resTimeS").val(resTimeSF);
			$("#roomIds").val(pkRoomIdtr);
			var valdateTaocan = validaUTaocan();
			var typeTaocanId = $("#typeTaocan").val();
			if (typeTaocanId == "ZBSP1408070540") {
				$("#basicPkg").val(typeTaocanId + "#");
			} else {
				if (valdateTaocan.length < 12) {
					$.messager.alert('提示', '请重新修改 选择 搭配套餐！', 'warning');
					return;
				}
				var basic1Value = typeTaocanId + "#" + valdateTaocan;
				$("#basicPkg").val(basic1Value);
			}

			var basp2Value = getAddPrds("fujiacBox", "");//  附加菜单  值
			$("#basicPkg2").val(basp2Value);
			var baspk3Value = getAddPrds("qiqiuTriBox", "");//  装饰  值
			$("#basicPkg3").val(baspk3Value);
			var moTimsValue = $("#modiTimedis").val();
			$("#pmodiTime").val(moTimsValue);
			var moByidValue = $("#modibydis").val();
			$("#modiby").val(moByidValue);
			var url = '${basePath }parreserve/addParReserveFujia.shtml?addType='
					+ divId;
			$
					.ajax({
						url : url,
						type : 'POST',
						data : $("#form1").serialize(),//序列化表单里所有的内容
						async : false,
						error : function(XMLHttpRequest) {
							ajaxError(XMLHttpRequest);
						},
						success : function(data) {
							if (data != null) {
								for ( var o in data) {
									if (o == "pkParresId") {
										$("#pkParresId").val(data[o]);
									} else if (o == "basicPkg2") {
										$("#addbasicPkg2").val(data[o]);
									} else if (o == "basicPkg3") {
										$("#addbasicPkg3").val(data[o]);
									}
								}
								if (divId == "fujia") {
									$("#fujiaTable").remove();
									$("#foot1").remove();
									document.getElementById("addfujiaTableDiv").style.display = 'block';
									document.getElementById("addfoot1").style.display = 'block';
									initTab("addformFujia4", "addfujiaTable",
											"addfoot1", addTrFujia);
								} else {
									$("#trimmingtable").remove();
									$("#foot2").remove();
									document
											.getElementById("addtrimmingtableDiv").style.display = 'block';
									document.getElementById("addfoot2").style.display = 'block';
									initTabTrim("addformZhuangshi4",
											"addtrimmingtable", "addfoot2",
											addTrming);
								}
								$('#' + divId).window('close');
							} else {
								$.messager.alert('提示', '增加失败！', 'error');
							}
						}
					});
			//end save
		}
	}
	function updateTaocanzhushi(dispalyDivid) {
		if (dispalyDivid == 1) {
			dispalyDivid = "hoverre";
		} else {
			dispalyDivid = "hoverleng";
		}
		var addHoverArray = new Array("hoverre", "hoverleng"); //附加主食分类 divid 的数组
		var jiaPrdNameListDivArray = new Array("updatezhushiRe",
				"updatezhushiLeng"); //附加主食列表 divid 的数组
		var dispalyZhuDiv = document.getElementById(dispalyDivid);
		var hiddenZhuDiv = '';
		for (var i = 0; i < addHoverArray.length; i++) {
			if (dispalyDivid == addHoverArray[i]) {
				dispalyZhuDiv.className = 'peic_hover';
				document.getElementById(jiaPrdNameListDivArray[i]).style.display = 'block';
			} else {
				hiddenZhuDiv = document.getElementById(addHoverArray[i]);
				hiddenZhuDiv.className = '';
				document.getElementById(jiaPrdNameListDivArray[i]).style.display = 'none';
			}
		}
	}

	function addFujiaCate(dispalyDivid) {//弹出层  附加菜单  分类 动态 div展示
		var addHoverArray = new Array("addhoverre", "addhoverleng",
				"addPeicai", "addTdian", "addyliao", "addwine"); //附加菜单食物分类 divid 的数组
		var jiaPrdNameListDivArray = new Array("addjiaRe", "addjiaLeng",
				"addJiapeicai", "addjiaTdian", "addjiaYliao", "addjiaWine"); //附加菜单食物列表 divid 的数组
		var dispalyZhuDiv = document.getElementById(dispalyDivid);
		var hiddenZhuDiv = '';
		for (var i = 0; i < addHoverArray.length; i++) {
			if (dispalyDivid == addHoverArray[i]) {
				dispalyZhuDiv.className = 'peic_hover';
				document.getElementById(jiaPrdNameListDivArray[i]).style.display = 'block';
			} else {
				hiddenZhuDiv = document.getElementById(addHoverArray[i]);
				hiddenZhuDiv.className = '';
				document.getElementById(jiaPrdNameListDivArray[i]).style.display = 'none';
			}
		}

	}

	function addTrimCate(dispalyDivid) {// 弹出层 装饰物  分类 动态 div展示
		var addHoverArray = new Array("addTrQiqiu", "addTrPDingzhi",
				"addTrCaidanl", "addTrbiaoyl"); // 装饰物  分类 divid 的数组
		var TrimNameListDivArray = new Array("addqiqiuTri", "addDingzhiTri",
				"addcaidanTri", "addbiaoyTri"); // 装饰物  列表 divid 的数组
		var dispalyZhuDiv = document.getElementById(dispalyDivid);
		var hiddenZhuDiv = '';
		for (var i = 0; i < addHoverArray.length; i++) {
			if (dispalyDivid == addHoverArray[i]) {
				dispalyZhuDiv.className = 'peic_hover';
				document.getElementById(TrimNameListDivArray[i]).style.display = 'block';
			} else {
				hiddenZhuDiv = document.getElementById(addHoverArray[i]);
				hiddenZhuDiv.className = '';
				document.getElementById(TrimNameListDivArray[i]).style.display = 'none';
			}
		}

	}
	function validaTuanForm(divType) {
		var subject = $("#subject").val();
		var conName = $("#conName").val();
		var conTel = $("#conTel").val();
		var conMobile = $("#conMobile").val();
		var resDay = $("#presDay").val();
		var resMemCnt = $("#resMemCnt").val();
		if (subject == "") {
			$.messager.alert('提示', '请输入主题！', 'warning');
			return false;
		}
		if (subject.length > 40) {
			$.messager.alert('提示', '输入的主题过长，请保持在40字符以内！', 'warning');
			return false;
		}
		if (conName == "") {
			$.messager.alert('提示', '请输入联系人！', 'warning');
			return false;
		}
		if (conName.length > 40) {
			$.messager.alert('提示', '输入的联系人过长，请保持在40字符以内！', 'warning');
			return false;
		}
		if ("" != conTel && conTel.length > 15) {
			$.messager.alert('提示', '输入的固话过长，请保持在15字符以内！', 'warning');
			return false;
		}
		if (conMobile == "") {
			$.messager.alert('提示', '请输入手机号码！', 'warning');
			return false;
		}
		if (conMobile.length > 15) {
			$.messager.alert('提示', '输入的手机号码过长，请保持在15字符以内！', 'warning');
			return false;
		}

		var pkRoomIdtr = checkRoomId();
		if (pkRoomIdtr == "") {
			$.messager.alert('提示', '请选择房间！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return false;
		}
		if (resDay == "") {
			$.messager.alert('提示', '请选择日期！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return false;
		}
		var typeTaocanId = $("#typeTaocan").val();
		if (typeTaocanId == "") {
			$.messager.alert('提示', '请选择类型！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return false;
		}

		var resTimeSF = document.getElementById("resTimeS").value;
		if (resTimeSF == "") {
			$.messager.alert('提示', '请选择开始时间！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return false;
		}
		var cengType;
		if (divType != "") {
			cengType = divType;
		}
		if (cengType != "#p" && cengType != "p" && divType != ""
				&& typeTaocanId == "ZBSP1408070540") {
			$.messager.alert('提示', '已选择的类型不符合规定，请重新选择。', 'info');
			return false;
		}
     var overtimev =$("#overTime").val();
     var fkOtprdId =$("#fkOtprdId").val();
     if(fkOtprdId !=""){
    	 if(overtimev ==""){
    		 $.messager.alert('提示', '请选择加时时长！', 'warning');
    		 return false;
    	 }
     }
     
     if(overtimev!=""){
    	 if(fkOtprdId==""){
    		 $.messager.alert('提示', '请选择加时房间类型！', 'warning');
    		 return false;
    	 }
     }
		if (resMemCnt == "") {
			$.messager.alert('提示', '请输入人数！', 'warning');
			return false;
		}
		return true;
	}
	function addRow() {

		//添加行
		var t = document.getElementById('fujiaTable');

		var newTr = t.insertRow();

		//添加列

		var newTd0 = newTr.insertCell();

		var newTd1 = newTr.insertCell();

		var newTd2 = newTr.insertCell();

		var newTd3 = newTr.insertCell();

		//设置列内容和属性 
		newTd0.innerHTML = document.all("a").options[document.all("a").selectedIndex].text;

		newTd1.innerHTML = '<input type="text" name="b">';

		newTd2.innerHTML = '<input type="text" name="c">';

		newTd3.innerHTML = '<input type="button" name="del" value="删除" onclick="del(this)">';

	}
	function del(o, typeDiv) {
		if (typeDiv == 11) {
			typeDiv = 'fujiaTable';
		} else if (typeDiv == 12) {
			typeDiv = 'addfujiaTable';
		} else if (typeDiv == 21) {
			typeDiv = 'trimmingtable';
		} else if (typeDiv == 22) {
			typeDiv = 'addtrimmingtable';
		}

		var t = document.getElementById(typeDiv);
		var tDId = o.id;
		var delPrd = '';
		var sPrdId = '';
		var checkId = "";
		var divId;
		if (typeDiv == 11 || typeDiv == 12) {
			divId = 'fujia';
		} else {
			divId = 'p';
		}
		if (!validaTuanForm(divId)) {
		} else {
			if (typeDiv == 'fujiaTable' || typeDiv == 'addfujiaTable') {
				for (var k = 0; k < fujiaPrdArray.length; k++) {
					sPrdId = fujiaPrdArray[k].substring(0, fujiaPrdArray[k]
							.indexOf("#"));
					checkId = "fujiacBox" + sPrdId;
					if (document.getElementById(checkId) != null) {
						document.getElementById(checkId).checked = false;
					}
					if (tDId.lastIndexOf(sPrdId) != -1) {
						delPrd += fujiaPrdArray[k] + ",";
					}
				}
				var delPrds = delPrd.split(",");
				for ( var x in delPrds) {
					fujiaPrdArray.remove(delPrds[x]);//删除旧的 值
				}
				t.deleteRow(o.parentNode.parentNode.rowIndex);
				fujiaDiv('fujia');
			} else if (typeDiv == 'trimmingtable'
					|| typeDiv == 'addtrimmingtable') {
				for (var m = 0; m < trimPrdArray.length; m++) {
					var sPrdId = trimPrdArray[m].substring(0, trimPrdArray[m].indexOf("#"));
					checkId = "addqiqiu" + sPrdId;
					if (document.getElementById(checkId) != null) {
						document.getElementById(checkId).checked = false;
					}
					if (tDId.lastIndexOf(sPrdId) != -1) {
						delPrd += trimPrdArray[m] + ",";
					}
				}
				var delPrds = delPrd.split(",");
				for ( var xx in delPrds) {
					trimPrdArray.remove(delPrds[xx]);//删除旧的 值
				}
				t.deleteRow(o.parentNode.parentNode.rowIndex);
				fujiaDiv('p');
			}
		}

	}

	function closeDiv(divId, type) {
		if (type == 'save') {
			alertInfo("保存成功！");
		}
		$('#' + divId).window('close');
	}
	function cancelPage(pageName, type) {
		if (type == 'save') {
			alertInfo("保存成功！");
		}
		var guanlitype = '${guanliDetail}';
		if (guanlitype != "" && guanlitype == "guanliDetail") {
			var pkParresId = '${pkParresId}';
			var url = '${basePath }parreserve/parReserveManagesDetail.shtml?pkParresId='
					+ pkParresId + '&grpFlag=1';
			window.location.href = url;
		} else {
			window.location.href = pageName;
		}

	}

	function editTaocanControl(divId) {//团体 修改 套餐
		if (!validaTuanForm(divId)) {
			$('#' + divId).window('close');
		}
		var pkRoomIdtr = checkRoomId();
		if (pkRoomIdtr == "") {
			$.messager.alert('提示', '请选择房间！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return;
		}
		var resTimeSF = $("#resTimeS").val();
		if (resTimeSF == "") {
			$.messager.alert('提示', '请选择开始时间！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return;
		}
		//=======ajax 根据房间编号，时间，查找是否 房间已经占用
		var ptime = resTimeSF.substring(0, 2);
		var typeTaocanId = $("#typeTaocan").val();
		var houTime;
		if (typeTaocanId != "" && typeTaocanId == "ZBSP1408070542") {
			if (ptime.substring(0, 1) == 0) {
				houTime = parseInt(ptime.substring(1, 2)) + 6;
			} else {
				houTime = parseInt(ptime) + 6;
			}

		} else {
			if (ptime.substring(0, 1) == 0) {
				houTime = parseInt(ptime.substring(1, 2)) + 4;
			} else {
				houTime = parseInt(ptime) + 4;
			}
		}
		var dresTimeE = houTime + resTimeSF.substring(2, 4);
		var showTimeE = houTime + ":" + resTimeSF.substring(2, 4);
		var rpresDay = $("#presDay").val();
		var pkParresId = $("#pkParresId").val();

		var url = '${basePath }parreserve/findAlreadyRoomList.shtml';
		$
				.ajax({
					url : url,
					type : 'POST',
					data : "roomId=" + pkRoomIdtr + "&presDay=" + rpresDay
							+ "&resTimeS=" + resTimeSF + "&resTimeE="
							+ dresTimeE + "&pkParresId=" + pkParresId,
					async : false,
					error : function(XMLHttpRequest) {
						ajaxError(XMLHttpRequest);
					},
					success : function(data) {
						if (data != null) {
							var parReserveList;
							for ( var o in data) {
								if (o == "parReserveList") {
									jsonarray = data[o];
									if (jsonarray != null
											&& jsonarray.length > 0) {
										var resTimestext;
										var resTimeEtext;
										var roomName = "(";
										for (var k = 0; k < jsonarray.length; k++) {
											var jsonobj = jsonarray[k];
											if (jsonobj != null) {
												resTimestext = jsonobj["resTimeS"];
												resTimeEtext = jsonobj["resTimeE"];
												roomName += jsonobj["roomName"]
														+ " ";
											}
										}
										roomName += ")";
										var msg = rpresDay + " " + resTimestext
												+ "-" + resTimeEtext
												+ " 时间段的房间" + roomName
												+ " 已经被预约，请重新选择时间段或 房间！";
										$.messager.alert('提示', msg, 'warning');
										$("#resTimeS").val("");
										refreshSelect();
										return;
									} else {
										$("#roomIds").val(pkRoomIdtr);
										var valdateTaocan = validaUTaocan();
										var typeTaocanId = $("#typeTaocan")
												.val();
										if (typeTaocanId == "ZBSP1408070540") {
											$("#basicPkg").val(
													typeTaocanId + "#");
										} else {
											if (valdateTaocan.length < 12) {
												$.messager.alert('提示',
														'请重新修改 选择 搭配套餐！',
														'warning');
												return;
											}
											document.getElementById("basicPkg").value = typeTaocanId
													+ "#" + valdateTaocan;
										}
										$("#resTimeE").val(dresTimeE);
										$("#resTimeS").val(resTimeSF);

										var basp2Value = getAddPrds(
												"fujiacBox", "");//  附加菜单  值
										$("#basicPkg2").val(basp2Value);
										var baspk3Value = getAddPrds(
												"qiqiuTriBox", "");//  装饰  值
										$("#basicPkg3").val(baspk3Value);
										var moTimsValue = $("#modiTimedis")
												.val();
										$("#pmodiTime").val(moTimsValue);
										var moByidValue = $("#modibydis").val();
										$("#modiby").val(moByidValue);
										var url = '${basePath }parreserve/updateZhushi.shtml';
										$.messager
												.confirm(
														'修改套餐',
														'确认修改套餐?',
														function(r) {
															if (r) {
																$
																		.ajax({
																			url : url,
																			type : 'POST',
																			data : $(
																					"#form1")
																					.serialize(),//序列化表单里所有的内容
																			async : false,
																			error : function(
																					XMLHttpRequest) {
																				ajaxError(XMLHttpRequest);
																			},
																			success : function(
																					data) {

																				if (data != null) {
																					$.messager
																							.alert(
																									'提示',
																									'修改成功！',
																									'info');
																					var arr = [];
																					var jsonarray;
																					for ( var o in data) {
																						if (o == "pkParresId") {
																							$(
																									"#pkParresId")
																									.val(
																											data[o]);
																						} else if (o == "listUpdateScmTaocan") {
																							jsonarray = data[o];
																							var divIdP = "openCengValid('#q')";
																							arr
																									.push('<table class="table">');
																							for (var k = 0; k < jsonarray.length; k++) {
																								var jsonobj = jsonarray[k];
																								if (k == 0) {
																									arr
																											.push('<tr><td>主食1</td><td>'
																													+ jsonobj["cateName"]
																													+ '：'
																													+ jsonobj["prdName"]
																													+ ' </td>');
																									arr
																											.push('<td rowspan="${gblScmTaocanSize}"><input type="button" onClick=" '+divIdP+' " class="btn" value="修&nbsp;&nbsp;改"></td></tr>');
																								} else if (k == 1) {
																									arr
																											.push('<tr><td>主食2</td><td>'
																													+ jsonobj["cateName"]
																													+ '：'
																													+ jsonobj["prdName"]
																													+ ' </td></tr>');
																								} else {
																									arr
																											.push('<tr><td>'
																													+ jsonobj["cateName"]
																													+ '</td><td>'
																													+ jsonobj["prdName"]
																													+ '</td></tr>');
																								}
																							}
																							arr
																									.push('</table>');
																							var parTaocanDiv = document
																									.getElementById("parTaocan");
																							parTaocanDiv.innerHTML = arr
																									.join('');
																							$(
																									'#'
																											+ divId)
																									.window(
																											'close');
																						}

																					}

																				} else {
																					$.messager
																							.alert(
																									'提示',
																									'修改失败！',
																									'error');
																				}
																			}
																		});
															}
														});

									}
								}
							}
						} else {
							$.messager.alert('提示', '保存失败！', 'error');
						}
					}
				});
		//========

	}

	function checkRoomId() {
		var str = document.getElementsByName("pkRoomId");
		var pkRoomIdtr = "";
		for (var i = 0; i < str.length; i++) {
			if (str[i].checked) {
				pkRoomIdtr += str[i].value + ",";
			}
		}
		if (pkRoomIdtr.substring(pkRoomIdtr.length - 1, pkRoomIdtr.length) == ",") {
			pkRoomIdtr = pkRoomIdtr.substring(0, pkRoomIdtr.length - 1);
		}
		return pkRoomIdtr;

	}
	function nextSave() {
		if (!validaTuanForm('')) {
		} else {

			var trueFlag = true;
			var pkRoomIdtr = checkRoomId();
			if (pkRoomIdtr == "") {
				$.messager.alert('提示', '请选择房间！', 'warning');
				$("#resTimeS").val("");
				refreshSelect();
				trueFlag = false;
				return;
			}
			var resTimeSF = $("#resTimeS").val();
			if (resTimeSF == "") {
				$.messager.alert('提示', '请选择开始时间！', 'warning');
				$("#resTimeS").val("");
				refreshSelect();
				trueFlag = false;
				return;
			}
			var resMemCnt = $("#resMemCnt").val();
			if (resMemCnt == "") {
				$.messager.alert('提示', '请输入人数！', 'warning');
				trueFlag = false;
				return;
			} else {
				//此处的  验证总人数不能超过房间最大容量，否则提示“房间容量超限”

				var checkRoomArray = pkRoomIdtr.split(",");
				var roomMax = 0;
				var roomMin = 0;
				for (var cc = 0; cc < checkRoomArray.length; cc++) {
					for (var mm = 0; mm < maxCntRoomArray.length; mm++) {
						var maxCntRoom = maxCntRoomArray[mm];
						var roomsArray = maxCntRoom.split("@");
						var roomid = roomsArray[0];
						var maxCnt = roomsArray[2];
						var minCnt = roomsArray[3];
						if (roomid == checkRoomArray[cc]) {
							roomMax = parseInt(maxCnt) + parseInt(roomMax);
							roomMin = parseInt(minCnt) + parseInt(roomMin);
							break;
						}
					}
				}
				if (roomMax < resMemCnt) {
					$.messager.alert('提示', '选择的房间最大人数是【' + roomMax
							+ '】，容纳人数超限，请增加房间或减少人数。', 'warning');
					trueFlag = false;
					return;
				}
				if (roomMin > resMemCnt) {
					$.messager.alert('提示', '人数 必须   大于 或等于 选择的房间最小人数【'
							+ roomMin + '】。', 'warning');
					trueFlag = false;
					return;
				}
			}

			//=======ajax begin
			var ptime = resTimeSF.substring(0, 2);
			var typeTaocanId = $("#typeTaocan").val();
			var houTime;
			if (typeTaocanId != "" && typeTaocanId == "ZBSP1408070542") {
				if (ptime.substring(0, 1) == 0) {
					houTime = parseInt(ptime.substring(1, 2)) + 6;
				} else {
					houTime = parseInt(ptime) + 6;
				}

			} else {
				if (ptime.substring(0, 1) == 0) {
					houTime = parseInt(ptime.substring(1, 2)) + 4;
				} else {
					houTime = parseInt(ptime) + 4;
				}
			}
			var dresTimeE = houTime + resTimeSF.substring(2, 4);
			var showTimeE = houTime + ":" + resTimeSF.substring(2, 4);
			var rpresDay = $("#presDay").val();
			var pkParresId = $("#pkParresId").val();
			//=======ajax 根据房间编号，时间，查找是否 房间已经占用
			var url = '${basePath }parreserve/findAlreadyRoomList.shtml';
			$
					.ajax({
						url : url,
						type : 'POST',
						data : "roomId=" + pkRoomIdtr + "&presDay=" + rpresDay
								+ "&resTimeS=" + resTimeSF + "&resTimeE="
								+ dresTimeE + "&pkParresId=" + pkParresId,
						async : false,
						error : function(XMLHttpRequest) {
							ajaxError(XMLHttpRequest);
						},
						success : function(data) {
							if (data != null) {
								var parReserveList;
								for ( var o in data) {
									if (o == "parReserveList") {
										jsonarray = data[o];
										if (jsonarray != null&& jsonarray.length > 0) {
											var resTimestext;
											var resTimeEtext;
											var roomName = "(";
											for (var k = 0; k < jsonarray.length; k++) {
												var jsonobj = jsonarray[k];
												if (jsonobj != null) {
													resTimestext = jsonobj["resTimeS"];
													resTimeEtext = jsonobj["resTimeE"];
													roomName += jsonobj["roomName"]
															+ " ";
												}
											}
											roomName += ")";
											var msg = rpresDay + " "
													+ resTimestext + "-"
													+ resTimeEtext + " 时间段的房间"
													+ roomName
													+ " 已经被预约，请重新选择时间段或 房间！";
											$.messager.alert('提示', msg,
													'warning');
											$("#resTimeS").val("");
											refreshSelect();

											return;
										} else {
											var valdateTaocan = validaUTaocan();
											$("#roomIds").val(pkRoomIdtr);

											if (typeTaocanId == "ZBSP1408070540") {
												$("#basicPkg").val(
														typeTaocanId + "#");
											} else {
												if (valdateTaocan.length < 12) {
													$.messager.alert('提示',
															'请重新修改 选择 搭配套餐！',
															'warning');
													trueFlag = false;
													return;
												}
												$("#basicPkg")
														.val(
																typeTaocanId
																		+ "#"
																		+ valdateTaocan);
											}
											if (trueFlag) {
												$("#resTimeE").val(dresTimeE);
												$("#resTimeS").val(resTimeSF);

												var basp2Value = getAddPrds(
														"fujiacBox", "");//  附加菜单  值
												$("#basicPkg2").val(basp2Value);
												var baspk3Value = getAddPrds(
														"qiqiuTriBox", "");//  装饰  值
												$("#basicPkg3")
														.val(baspk3Value);
												var moTimsValue = $(
														"#modiTimedis").val();
												$("#pmodiTime")
														.val(moTimsValue);
												var moByidValue = $(
														"#modibydis").val();
												$("#modiby").val(moByidValue);
												var url = '${basePath }parreserve/saveParReserve.shtml';

												$.ajax({
															url : url,
															type : 'POST',
															data : $("#form1").serialize(),//序列化表单里所有的内容
															async : false,
															error : function(
																	XMLHttpRequest) {
																ajaxError(XMLHttpRequest);
															},
															success : function(
																	data) {
																if (data != null) {
																	var pkParresIdold;
																	var orderPk;
																	var zhucanPrice;
																	var OldpkOrderId;
																	for ( var o in data) {
																		if (o == "pkParresId") {
																			pkParresIdold = data[o];
																		} else if (o == "orderPk") {
																			orderPk = data[o];
																		} else if (o == "zhucanPrice") {
																			zhucanPrice = data[o];
																		} else if (o == "OldpkOrderId") {
																			OldpkOrderId = data[o];
																		}
																	}
																	var parType = $(
																			"#grpFlag")
																			.val();
																	window.location.href = '${basePath }parreserve/saveNextParReserve.shtml?OldpkOrderId='
																			+ OldpkOrderId
																			+ '&pkParresId='
																			+ pkParresIdold
																			+ '&parType='
																			+ parType
																			+ '&orderPk='
																			+ orderPk
																			+ '&zhucanPrice='
																			+ zhucanPrice 
																			+ '&deviceType=pc';
																} else {
																	$.messager
																			.alert(
																					'提示',
																					'保存失败！',
																					'error');
																}
															}
														});
											}
										}
									}
								}
							} else {
								$.messager.alert('提示', '保存失败！', 'error');
							}
						}
					});
			//========
			//=======ajax end

		}
	}

	function radioShow(id) {
		var myradio = document.getElementsByName("type_r");
		for (var i = 0; i < myradio.length; i++) {
			if (myradio[i].checked) {
				if (id == 'r1')
					window.location.href = "parReserveDetail.shtml?parType=0&pkParresId="
							+ pkParresIdOld + "&pkOrderId="+ pkOrderIdOld;
				else
					window.location.href = "tuanReserveDetail.shtml?parType=1&pkParresId="
							+ pkParresIdOld + "&pkOrderId=" + pkOrderIdOld;
			}
		}
	}

	function hiddenSelected(divIds) {
		var noneZhuDivId = divIds.substring(divIds.indexOf("_"), divIds.length);
		var divId = divIds.substring(0, divIds.indexOf("_"));
		document.getElementById(divId).checked = false;
		document.getElementById(noneZhuDivId).style.display = 'none';

	}

	function saveParReserve() {//saveCusextcfg div
		window.location.href = "insertParReserve.shtml";
	}

	function resTimeEChange(o) {
		var pkRoomIdtr = checkRoomId();
		if (pkRoomIdtr == "") {
			$.messager.alert('提示', '请选择房间！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return false;
		}
		var typeTaocanId = $("#typeTaocan").val();
		if (typeTaocanId == "") {
			$.messager.alert('提示', '请选择类型！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return false;
		}
		var rpresDay = $("#presDay").val();
		if (rpresDay == "") {
			$.messager.alert('提示', '请选择日期！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return false;
		}
		var resTimeSF = $("#resTimeS").val();
		if (resTimeSF == "") {
			$.messager.alert('提示', '请选择开始时间！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return false;
		}
		var ptime = resTimeSF.substring(0, 2);

		var houTime;
		if (typeTaocanId != "" && typeTaocanId == "ZBSP1408070542") {
			if (ptime.substring(0, 1) == 0) {
				houTime = parseInt(ptime.substring(1, 2)) + 6;
			} else {
				houTime = parseInt(ptime) + 6;
			}

		} else {
			if (ptime.substring(0, 1) == 0) {
				houTime = parseInt(ptime.substring(1, 2)) + 4;
			} else {
				houTime = parseInt(ptime) + 4;
			}
		}
		var dresTimeE = houTime + resTimeSF.substring(2, 4);
		var showTimeE = houTime + ":" + resTimeSF.substring(2, 4);
		//=======ajax 根据房间编号，时间，查找是否 房间已经占用
		var url = '${basePath }parreserve/findAlreadyRoomList.shtml';
		var pkParresId = $("#pkParresId").val();
		$.ajax({
			url : url,
			type : 'POST',
			data : "roomId=" + pkRoomIdtr + "&presDay=" + rpresDay
					+ "&resTimeS=" + resTimeSF + "&resTimeE=" + dresTimeE
					+ "&pkParresId=" + pkParresId,
			async : false,
			error : function(XMLHttpRequest) {
				ajaxError(XMLHttpRequest);
			},
			success : function(data) {
				if (data != null) {
					var parReserveList;
					for ( var o in data) {
						if (o == "parReserveList") {
							jsonarray = data[o];
							if (jsonarray != null && jsonarray.length > 0) {
								var resTimestext;
								var resTimeEtext;
								var roomName = "(";
								for (var k = 0; k < jsonarray.length; k++) {
									var jsonobj = jsonarray[k];
									if (jsonobj != null) {
										resTimestext = jsonobj["resTimeS"];
										resTimeEtext = jsonobj["resTimeE"];
										roomName += jsonobj["roomName"] + " ";
									}
								}
								roomName += ")";
								var msg = rpresDay + " " + resTimestext + "-"
										+ resTimeEtext + " 时间段的房间" + roomName
										+ " 已经被预约，请重新选择时间段或 房间！";
								$.messager.alert('提示', msg, 'warning');
								$("#resTimeS").val("");
								refreshSelect();

								return false;
							} else {
								$("#resTimeE").val(dresTimeE);
								$("#showresTimeE").val(showTimeE);
								refreshSelect();
								return true;
							}
						}
					}
				} else {
					$.messager.alert('提示', '保存失败！', 'error');
				}
			}
		});
		//========
	}

	window.onload = function() {
		var $numInfo = document.getElementById('num_info'), $num = document
				.getElementById('conMobile'), _val, _val1, _val2;
		$num.onkeyup = function() {
			var val = this.value = this.value.replace(/[^\d]/g, ''), len = val.length;
			if (val != '') {
				$numInfo.style.display = 'block';
			}
			if (len <= 3) {
				_val = _val1 = val.substr(0, 3);
			} else if (len > 3 && len <= 7) {
				_val1 = val.substr(0, 3);
				_val = _val2 = _val1 + "-" + val.substr(3, len);
			} else if (len > 7) {
				_val2 = val.substr(0, 3) + "-" + val.substr(3, 4);
				_val = _val2 + '-' + val.substr(7, len);
			}
			$numInfo.innerHTML = _val;
		}
		$num.onblur = function() {
			$numInfo.style.display = 'none';
		}
	}
	function tomorrow() {
		var tommorrow = new Date();
		tommorrow.setDate(tommorrow.getDate() + 1);
		return getSmpFormatDate(tommorrow, "");
	}

	function initValidHoliday() {
		var url = '${basePath }parreserve/findValidHoliday.shtml?pkParresIdOld='
				+ pkParresIdOld;
		$.ajax({
			url : url,
			type : 'POST',
			async : false,
			error : function(XMLHttpRequest) {
				ajaxError(XMLHttpRequest);
			},
			success : function(data) {
				var dateStr = "";

				if (data != null) {
					var holidayList;
					for ( var o in data) {

						if (o == "holidayList") {
							jsonarray = data[o];
							if (jsonarray != null && jsonarray.length > 0) {
								dateStr = "(";
								for (var k = 0; k < jsonarray.length; k++) {
									if (k > 0) {
										dateStr += "|" + jsonarray[k];
									} else {
										dateStr += jsonarray[k];
									}
								}

								dateStr += ")";
								validHolidays = dateStr;
							}
						}

					}
				}
			}
		});

	}

	function jiaqiDisable() {
		return validHolidays;
	}
	
	function checkpcount(){//检测 输入的人数是否符合 房间 的 容纳 范围
		var pkRoomIdtr = checkRoomId();
		if (pkRoomIdtr == "") {
			$.messager.alert('提示', '请选择房间！', 'warning');
			$("#resTimeS").val("");
			refreshSelect();
			return false;
		}
		var resMemCnt = $("#resMemCnt").val();
		if (resMemCnt == "") {
			$.messager.alert('提示', '请输入人数！', 'warning');
			return;
		} else {
			//此处的  验证总人数不能超过房间最大容量，否则提示“房间容量超限”

			var checkRoomArray = pkRoomIdtr.split(",");
			var roomMax = 0;
			var roomMin = 0;
			for (var cc = 0; cc < checkRoomArray.length; cc++) {
				for (var mm = 0; mm < maxCntRoomArray.length; mm++) {
					var maxCntRoom = maxCntRoomArray[mm];
					var roomsArray = maxCntRoom.split("@");
					var roomid = roomsArray[0];
					var maxCnt = roomsArray[2];
					var minCnt = roomsArray[3];
					if (roomid == checkRoomArray[cc]) {
						roomMax = parseInt(maxCnt) + parseInt(roomMax);
						roomMin = parseInt(minCnt) + parseInt(roomMin);
						break;
					}
				}
			}
			if (roomMax < resMemCnt) {
				$.messager.alert('提示', '选择的房间最大人数是【' + roomMax
						+ '】，容纳人数超限，请增加房间或减少人数。', 'warning');
				trueFlag = false;
				return;
			}
			if (roomMin > resMemCnt) {
				$.messager.alert('提示', '人数 必须   大于 或等于 选择的房间最小人数【'
						+ roomMin + '】。', 'warning');
				return;
			}
		}
	}
</script>
<title>团体预约详细</title>
</head>
<body class="bg">


<div class="content m_auto">
    <div class="content_l mt10">
        <ul>
        	<shiro:hasPermission name="membership/single/jumpSingleTicket.shtml">
        	<li ><a href="${basePath }membership/single/jumpSingleTicket.shtml"><i class="nav_icon_a"></i><br>单次票</a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="membership/member/jumpMember.shtml">
				<li><a href="${basePath }membership/member/jumpMember.shtml"><i class="nav_icon_b"></i><br>会籍</a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="membership/visitor/jumpVisitor.shtml">
				<li><a href="${basePath }membership/visitor/jumpVisitor.shtml"><i class="nav_icon_d"></i><br>访客</a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="parreserve/loadParReserve.shtml">
				<li class="content_hover"><a href="${basePath }parreserve/loadParReserve.shtml"><i class="nav_icon_g"></i><br>派对/团体预约</a></li>
	        </shiro:hasPermission>
        </ul>
    </div>
 
    <div class="content_r mt10">
    <form name="form1" action="" id="form1">
        <div class="collection_h1 fixed">
        	<ul class="order">
            	<li class="order_a"><i class="order_icon">1</i>信息采集</li>
                <li class="order_b"><i class="order_icon_hui">2</i>下单</li>
            </ul>
        </div>
        <br>
        <div> 
        	<font size="+1">&nbsp;&nbsp;
        	<c:if test="${pkOrderId==''}">
        	<input type="radio" name="type_r" id="r1" onClick="radioShow('r1');" <c:if test="${parType==0}">checked</c:if> style="vertical-align:middle;">&nbsp;派对预约&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        	<input type="radio" name="type_r" onClick="radioShow('r2');"  id="r2" <c:if test="${parType==0}">checked</c:if> style="vertical-align:middle;" checked>&nbsp;团体预约
        	</c:if>
        	<c:if test="${pkOrderId!=''}">
        	    <c:choose>
        	    	<c:when test="${parType=='1'}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;团体预约&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</c:when>
        	    	 <c:otherwise>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;派对预约&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</c:otherwise>
        	    </c:choose>
        	</c:if>
        	</font>
        </div>
        <div class="mt10">
        	<div class="order_add_l">
            	<dl class="order_add_l_dlx">
                	<dd><label><font style="color:#F00">*</font>主题：</label><input ${disableIsShow} id="subject" maxlength="30"  name="subject" value="${parreserveOld.subject}" type="text" class="iput_t w200" ></dd>
                    <dd><label><font style="color:#F00">*</font>联系人：</label><input ${disableIsShow} id="conName" maxlength="30"  value="${parreserveOld.conName}" name="conName" type="text" class="iput_t w200"  ></dd>
                    <dd><label>固话：</label><input ${disableIsShow} id="conTel" name="conTel" type="text" maxlength="20"  class="iput_t w200" value="${parreserveOld.conTel}">
                    	<input type="hidden" name="basicPkg" id="basicPkg"  value="${parreserveOld.basicPkg}">
                    	<input type="hidden" name="pkParresId" id="pkParresId" value="${pkParresId}">
                    	<input type="hidden" name="pkOrderId" id="pkOrderId" value="${pkOrderId}">
                    	<input type="hidden" name="pmodiTime" id="pmodiTime">
                    	<input type="hidden" name="modiBy" id="modiby"  value="${parreserveOld.modiBy}">
                    	<input type="hidden" name="basicPkg2" id="basicPkg2" value="${parreserveOld.basicPkg2}">
                    	<input type="hidden" name="basicPkg3" id="basicPkg3" value="${parreserveOld.basicPkg3}">
                    	<input type="hidden" name="paramtype" id="paramtype">
                    	<input type="hidden" name="roomIds" id="roomIds"  value="${parreserveOld.roomIds}">
                    	<input type="hidden" name="grpFlag" id="grpFlag" value="${parType}">
                    </dd>
                    <dd><label><font style="color:#F00">*</font>手机 ：</label>
                     <div class="formx fl">
                      <span id="num_info" for="conMobile"></span>
                      <input ${disableIsShow} id="conMobile" name="conMobile" type="text" maxlength="11" class="iput_t w200" value="${parreserveOld.conMobile}">
                    </div>
                    <dd><label>Email：</label><input ${disableIsShow} id="conEmail" name="conEmail" maxlength="50" id="conEmail" class="iput_t w200" value="${parreserveOld.conEmail}"></dd>
                    <dd><label><font color="#FF0000"> * </font>房间：</label>
                    	<ul class="ul_radio order_xradio">
                    	   <c:forEach items="${listRoom}" var="roomf">
                            <li><input type="checkbox" class="mr5" name="pkRoomId" id="pkRoomid${roomf.pkRoomId}" value="${roomf.pkRoomId}" />${roomf.roomName}</li>
                            </c:forEach>
                        </ul>
                    </dd>
                    <dd><label><font style="color:#F00">*</font>日期：</label>
                    <c:choose>
                     <c:when test="${showDaycontrols=='lessFifteen' }">
                       <input type="text"  class="Wdate iput_t w200" id="presDay" name="presDay" value="${parreserveOld.presDay}" readonly="readonly" title="举办日期在15日之内，不允许改期">
                     </c:when>
                     <c:otherwise>
                      <input type="text"  class="Wdate iput_t w200" id="presDay" name="presDay" value="${parreserveOld.presDay}"   onClick="WdatePicker({dateFmt:'yyyy-MM-dd ',minDate:'#F{tomorrow()}',disabledDays:[0,5,6],disabledDates:['#F{jiaqiDisable()}'],isShowWeek:true,isShowClear:true,isShowToday:false,readOnly:true})" > 
                     </c:otherwise>
                    </c:choose>
                    </dd>
                    <dd><label><font style="color:#F00">*</font>类型：</label><div class="uboxstyle">
			                        <select name="typeTaocan" id="typeTaocan" onchange="changeTaocanDiv()">
			                        <option value=""  selected="selected">请选择</option>
			                            <option value="ZBSP1408070540" >团体4小时单人（不含餐）</option>
			                            <option value="ZBSP1408070541">团体4小时单人（含餐）</option>
			                             <option value="ZBSP1408070542">团体6小时单人（含餐）</option>
			                        </select>
			                    </div> 
                    </dd>
                    <dd><label> <font style="color:#F00">*</font>开始时间：</label>
                     
  				  <span id="sel_end"  >
    				<div class="uboxstyle_small">
                        <select name="resTimeS" id="resTimeS"   onchange="resTimeEChange(this)">
                       		 <option value="">请选择</option>
                            <option value="0900">09:00</option>
                             <option value="0930">09:30</option>
                            <option value="1000">10:00</option>
                            <option value="1030">10:30</option>
                            <option value="1100">11:00</option>
                            <option value="1130">11:30</option>
                            <option value="1130">12:00</option>
                            <option value="1300">13:00</option>
                            <option value="1330">13:30</option>
                            <option value="1400">14:00</option>
                            <option value="1430">14:30</option>
                            <option value="1500">15:00</option>
                            <option value="1530">15:30</option>
                            <option value="1600">16:00</option>
                            <option value="1630">16:30</option>
                            <option value="1700">17:00</option>
                            <option value="1730">17:30</option>
                            <option value="1800">18:00</option>
                            <option value="1830">18:30</option>
                            <option value="1900">19:00</option>
                        </select>
                    </div><span class="ml5">-</span>
                         	 <input type="text" name="showresTimeE" id="showresTimeE"    class="iput_t w100" readonly>
   							<input type="hidden" name="resTimeE" id="resTimeE"  >
    </span></dd>
    <dd><label>加时时长：</label>
  				  <span id="sel_end"  >
    				<div class="uboxstyle_small">
                        <select name="overTime" id="overTime"  >
                       		 <option value="">请选择</option>
                            <option value="1">1小时</option>
                             <option value="2">2小时</option>
                        </select>
                    </div> 
    </span></dd>
    <dd><label>加时房间类型：</label>
  				  <span id="sel_end"  >
    				<div class="uboxstyle_small" >
                        <select name="fkOtprdId" id="fkOtprdId" >
                       		 <option value="">请选择</option>
                             <option value="ZBSP141126002">大房间</option>
                             <option value="ZBSP141126001">小房间</option>
                        </select>
                    </div> 
    </span></dd> 
                    <dd><label><font style="color:#F00">*</font>人数：</label>
                    <input type="text" name="resMemCnt" value="${parreserveOld.resMemCnt}" maxlength="3" id="resMemCnt" class="iput_t w100"    onkeyup="this.value=this.value.replace(/\D/g,'')" onblur="checkpcount()"  onafterpaste="this.value=this.value.replace(/\D/g,'')"><span class="color_9c9"></span></dd>
                    <dd><label>备注：</label><textarea name="comments" ${disableIsShow} id="comments" maxlength="150"  class="textare w200 h80">${parreserveOld.comments}</textarea></dd>
                    <dd><label>操作时间：</label><input type="text" name="modiTimedis" id="modiTimedis" class=" iput_t w200"    disabled > </dd>
                    <dd><label>操作人：</label><input type="text"   class=" iput_t w200" value="${modiName}"   disabled >
                    <input type="hidden" name="modibydis"  id="modibydis" class=" iput_t w200" value="${modiBy}"    ></dd>
                    <dd id="parstatus"></dd><dd> &nbsp;&nbsp;(已改期${parreserveOld.modiTimeCnt}次) <input   value="${parreserveOld.modiTimeCnt}" name="modiTimeCnt"   type="hidden"   ></dd>
                </dl>
            </div>
            <div class="order_add_r">
            	
				<dl class="order_add_r_dl">
					<dd>
						<h2>搭配套餐：</h2>
                        <div id="parTaocan">
                        </div>
                    </dd>
                    <dd>
                        <h2>附加菜单：</h2>
                          <div id="dfujiaTableDiv" style="display:none">
                        <table class="table" id="fujiaTable">
                            <tr>
                                <th>商品</th>
                                <th>价格(元)</th>
                                <th>数量</th>
                                <th>操作</th>
                            </tr>
                           
                        </table>
                        </div>
                        <div id="addfujiaTableDiv" style="display:none">
                      	  <table class="table" id="addfujiaTable"  >
                            <tr>
                                <th>商品</th>
                                <th>价格(元)</th>
                                <th>数量</th>
                                <th>操作</th>
                            </tr>
                       	 </table>
                         </div>
                    </dd>
                    <dd>
                    <c:choose>
	                    <c:when test="${disableIsShow=='disabled'}">&nbsp;</c:when>
	                    <c:otherwise>
	                     <input type="button" class="btn mt10" value="增加" onClick="openCengValid('#fujia')">
	                     </c:otherwise>
                    </c:choose>
                     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                    &nbsp;<div class="page fr m10" id="foot1">
							</div>
							<div class="page fr m10" id="addfoot1"  >
							</div>
                    </dd>
                    <dd>
                        <h2>装饰物：</h2>
                        <table class="table" id="trimmingtable" >
                            <tr>
                                <th>商品</th>
                                <th>价格(元)</th>
                                <th>数量</th>
                                <th>操作</th>
                            </tr>
                        </table>
                        <div id="addtrimmingtableDiv" style="display:none">
	                        <table class="table" id="addtrimmingtable"  >
	                            <tr>
	                                <th>商品</th>
	                                <th>价格(元)</th>
	                                <th>数量</th>
	                                <th>操作</th>
	                            </tr>
	                        </table>
                        </div>
                    </dd>
                    <dd>
                    <c:choose>
	                    <c:when test="${disableIsShow=='disabled'}">&nbsp;</c:when>
	                    <c:otherwise>
	                    <input type="button" class="btn mt10" value="增加" onClick="openCengValid('#p')">
	                     </c:otherwise>
                    </c:choose>
                    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                    &nbsp;<div class="page fr m10" id="foot2">
							</div>
							<div class="page fr m10" id="addfoot2"  style="display:none">
							</div>
							</dd>
				</dl>
            </div>
        </div>
        <div class="clear"></div>
        <div class="btm_btn mt30">
            <dl>
                <dd><input type="button" value="返回" onClick="cancelPage('loadParReserve.shtml','')" class="btn"></dd>
                <dd><input type="button" onclick="nextSave()" value="下一步" class="btn"></dd>
            </dl>
        </div>
        </form>
        <form action="${basePath }parreserve/paginateFujia.shtml" method="post" id="formFujia4">
							<input type="hidden" name="pageSize" value="4"> <input
								type="hidden" name="pageNo" value="1">  
		</form>
        <form action="${basePath }parreserve/paginateZhuangshi.shtml" method="post" id="formZhuangshi4">
		<input type="hidden" name="pageSize" value="4"> <input
			type="hidden" name="pageNo" value="1">  
	</form>
	
	        <form action="${basePath }parreserve/addPageFujia.shtml?addType=fujia" method="post" id="addformFujia4">
							<input type="hidden" name="pageSize" value="4"> <input
								type="hidden" name="pageNo" value="1"> 
								<input type="hidden" name="basicPkg2" id="addbasicPkg2" value="${parreserveOld.basicPkg2}">
		</form>
        <form action="${basePath }parreserve/addPageZhuangshi.shtml?addType=zhuangs" method="post" id="addformZhuangshi4">
		<input type="hidden" name="pageSize" value="4"> <input
			type="hidden" name="pageNo" value="1">  
			<input type="hidden" name="basicPkg3" id="addbasicPkg3" value="${parreserveOld.basicPkg3}"> 
	</form>
    </div>
</div>

<!---弹出层--->
<div id="q" class="easyui-window" title="修改套餐" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:820px; height:550px; position:relative;">
	
    <div class="tab_normal m10">
    	<div class="order_add_yix fixed">
    	
        	
        	
        	<dl>
            	<dt>已选主食：</dt>
            	<div id="alreadyZhu">
            	  
           </div>
            </dl>
            <dl>
            <dt>已选配菜：</dt>
         	   <div id="alreadyPeiCai">
            	
                </div>
            </dl>
            <dl>
            	<dt>已选饮料：</dt>
            	<div id="alreadyYinl">
            	 
                </div>
            </dl>
           
        </div>
    	<ul id="tab_a" class=" fixed">
           <li>主食（选3）</li>
           <li>配菜（选1）</li>
           <li>饮料（选1）</li>
        </ul>
       <div id="cengzhushi">
       
       </div>
    </div>
    <div class="btm_btn btm_bg">
    	<dl>
        	<dd><input type="button" class="btn" onClick="javascript:editTaocanControl('q')" value="确定"></dd>
            <dd><input type="button" class="btn" onClick="javascript:closeDiv('q','')" value="取消"></dd>
        </dl>
    </div>
</div>
<!---弹出层--->

 

 

<!---弹出层-附加菜单 -->
<div id="fujia" class="easyui-window" title="新增附加菜单" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:820px; height:400px; position:relative;">
	
    <div class="m10">
    	<dl class="order_add_peic fl">
			    	 <div id="addhoverre" class="peic_hover"><dt ><a href="javascript:addFujiaCate('addhoverre')">热食</a></dt></div>
			          <div id="addhoverleng" > <dt><a href="javascript:addFujiaCate('addhoverleng')">冷食</a></dt></div>
                	<div id="addPeicai" > <dt><a href="javascript:addFujiaCate('addPeicai')">配菜</a></dt></div>
                	<div id="addTdian" > <dt><a href="javascript:addFujiaCate('addTdian')">甜点</a></dt></div>
                	<div id="addyliao" > <dt><a href="javascript:addFujiaCate('addyliao')">饮料</a></dt></div>
                	<div id="addwine" > <dt><a href="javascript:addFujiaCate('addwine')">酒类 （仅限 成人）</a></dt></div>
                </dl>
                <dl class="fl order_add_peib">
                	 <div id="addjiaRe">
	                   <c:forEach items="${listGblFUjiaRe}" var="jiaRe" varStatus="status">
	                    <dd><input type="checkbox" id="fujiacBox${jiaRe.pkPrdId}" name="fujiacBox" value="${jiaRe.pkPrdId}">${jiaRe.prdName}</dd>
	                  </c:forEach>
	                  </div>
	                  <div id="addjiaLeng" style="display:none">
	                   <c:forEach items="${listGblFUjiaLeng}" var="jiaLeng" varStatus="status">
	                    <dd><input type="checkbox" id="fujiacBox${jiaLeng.pkPrdId}" name="fujiacBox" value="${jiaLeng.pkPrdId}">${jiaLeng.prdName}</dd>
	                  </c:forEach>
	                  </div>
	                  <div id="addJiapeicai" style="display:none">
	                   <c:forEach items="${listGblFUjiapeicai}" var="jiapeicai" varStatus="status">
	                    <dd><input type="checkbox" id="fujiacBox${jiapeicai.pkPrdId}" name="fujiacBox" value="${jiapeicai.pkPrdId}">${jiapeicai.prdName}</dd>
	                  </c:forEach>
	                  </div>
	                  <div id="addjiaTdian" style="display:none">
	                   <c:forEach items="${listGblparFUjiaTdian}" var="jiaTdian" varStatus="status">
	                    <dd><input type="checkbox" id="fujiacBox${jiaTdian.pkPrdId}" name="fujiacBox" value="${jiaTdian.pkPrdId}">${jiaTdian.prdName}</dd>
	                  </c:forEach>
	                  </div>
	                  <div id="addjiaYliao" style="display:none">
	                   <c:forEach items="${listGblparFUjiaYinliao}" var="jiaYliao" varStatus="status">
	                    <dd><input type="checkbox" id="fujiacBox${jiaYliao.pkPrdId}" name="fujiacBox" value="${jiaYliao.pkPrdId}">${jiaYliao.prdName}</dd>
	                  </c:forEach>
		                  </div>
		                  <div id="addjiaWine" style="display:none">
		                   <c:forEach items="${listGblparFUjiaWine}" var="jiaWine" varStatus="status">
		                    <dd><input type="checkbox" id="fujiacBox${jiaWine.pkPrdId}" name="fujiacBox" value="${jiaWine.pkPrdId}">${jiaWine.prdName}</dd>
		                  </c:forEach>
		                  </div>
	                </dl>
    </div>
    
    <div class="btm_btn btm_bg">
    	<dl>
        	<dd><input type="button" class="btn" onClick="javascript:fujiaDiv('fujia')" value="确定"></dd>
            <dd><input type="button" class="btn" onClick="javascript:closeDiv('fujia','')" value="取消"></dd>
        </dl>
    </div>
</div>
<!---弹出层--->
<!---弹出层--->
<div id="p" class="easyui-window" title="新增装饰物" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:820px; height:400px; position:relative;">
	
    <div class="m10">
    	<dl class="order_add_peic fl">
            <div id="addTrQiqiu" class="peic_hover"><dt ><a href="javascript:addTrimCate('addTrQiqiu')">气球</a></dt></div>
			          <div id="addTrPDingzhi" > <dt><a href="javascript:addTrimCate('addTrPDingzhi')">相片定制类</a></dt></div>
                	<div id="addTrCaidanl" > <dt><a href="javascript:addTrimCate('addTrCaidanl')">彩蛋类</a></dt></div>
                	<div id="addTrbiaoyl" > <dt><a href="javascript:addTrimCate('addTrbiaoyl')">表演类</a></dt></div>
        </dl>
        <dl class="fl order_add_peib">
           			<div id="addqiqiuTri">
	                   <c:forEach items="${listGblTrimmingQiqiu}" var="qiqiuTri" varStatus="status">
	                    <dd><input type="checkbox" id="addqiqiu${qiqiuTri.pkPrdId}" name="qiqiuTriBox" value="${qiqiuTri.pkPrdId}">${qiqiuTri.prdName}</dd>
	                  </c:forEach>
	                  </div>
	                  <div id="addDingzhiTri" style="display:none">
	                   <c:forEach items="${listGblTrimmingDingzhi}" var="dingzhiTri" varStatus="status">
	                    <dd><input type="checkbox" id="addqiqiu${dingzhiTri.pkPrdId}" name="qiqiuTriBox" value="${dingzhiTri.pkPrdId}">${dingzhiTri.prdName}</dd>
	                  </c:forEach>
	                  </div>
	                  <div id="addcaidanTri" style="display:none">
	                   <c:forEach items="${listGblTrimmingCDan}" var="caidanTri" >
	                    <dd><input type="checkbox" id="addqiqiu${caidanTri.pkPrdId}" name="qiqiuTriBox" value="${caidanTri.pkPrdId}">${caidanTri.prdName}</dd>
	                  </c:forEach>
	                  </div>
	                  <div id="addbiaoyTri" style="display:none">
	                   <c:forEach items="${listGblTrimmingBiao}" var="biaoyTri" varStatus="status">
	                    <dd><input type="checkbox" id="addqiqiu${biaoyTri.pkPrdId}" name="qiqiuTriBox" value="${biaoyTri.pkPrdId}">${biaoyTri.prdName}</dd>
	                  </c:forEach>
	                  </div>
        </dl>
    </div>
    
    <div class="btm_btn btm_bg">
    	<dl>
        	<dd><input type="button" class="btn" onClick="javascript:fujiaDiv('p')" value="确定"></dd>
            <dd><input type="button" class="btn" onClick="javascript:closeDiv('p','')" value="取消"></dd>
        </dl>
    </div>
</div>
<!---弹出层--->






  


</body>
</html>